let webpack = require('webpack');
let path = require('path');
module.exports = {
    entry: {
        'pageA': './src/pageA',
        // 'pageB': './src/pageB',
        // 'vendor':['lodash'],
    },
    output: {
        path: path.resolve(__dirname, './dist'),
        publicPath: './dist/',
        filename: '[name].bundle.js',
        chunkFilename: '[name].chunk.js',
    },
    module: {
        rules: [{
            test: /\.js$/,
            use: [{
                loader: 'babel-loader',
                options: {
                    presets: 'es2015',
                    plugins: ['syntax-dynamic-import']
                }
            }]
        }]
    },
    plugins: [
        new webpack.optimize.CommonsChunkPlugin({
            async: 'async-common',
            children:true,
            minChunks: 2 
        })
    ],
    // plugins: [
    //     new webpack.optimize.CommonsChunkPlugin({
    //         name: 'common',
    //         minChunks: 2,
    //         chunks: ['pageA','pageB']
    //     }),
    //     new webpack.optimize.CommonsChunkPlugin({
    //         name: ['vendor','manifest'],
    //         minChunks: Infinity
    //     }),
    // ]
}